//
//  GHOrderTableViewCell.m
//  GodHorses
//
//  Created by Mac on 2017/11/17.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLCarMessageTableViewCell.h"

@interface KLCarMessageTableViewCell ()

@property(nonatomic, strong) STLabel                         *titleLable;//名字
@property(nonatomic, strong) STLabel                         *addLable;


@end
@implementation KLCarMessageTableViewCell

+ (CGFloat)cellHeight{
    return 110;
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
#pragma mark --subView
- (void)configSubView{
    self.backgroundColor = [UIColor whiteColor];
    
    
    self.iconButton = [[STButton alloc] initWithFrame:CGRectMake(15, 10, 100, 90)
                                                title:nil
                                           titleColor:nil
                                            titleFont:0
                                         cornerRadius:0
                                      backgroundColor:nil
                                      backgroundImage:[UIImage imageNamed:@"06"]
                                                image:nil];
    [self addSubview:self.iconButton];

    
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconButton.right + 10, self.iconButton.top + 5, UIScreenWidth - 20 - self.iconButton.right, 40)
                                                text:@"name"
                                           textColor:KL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];

    [self addSubview:self.titleLable];
    
    
    self.addLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconButton.right + 10, self.titleLable.st_bottom   , 200, 40)
                                              text:@"绵阳 - "
                                         textColor:KL_thirdTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    
    [self addSubview:self.addLable];
    
    self.delButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 40, 30)
                                                     title:@"删除"
                                                titleColor:[UIColor whiteColor]
                                                 titleFont:14
                                              cornerRadius:4
                                           backgroundColor:KL_BlueBackGroundColor
                                           backgroundImage:nil
                                                     image:nil];
    self.delButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    self.delButton.right = UIScreenWidth - 15;
    self.delButton.centerY = self.addLable.centerY;
    [self addSubview:self.delButton];
    
}
- (void)setModel:(KLCarModel *)model{
    _model = model;
    [self.iconButton sd_setBackgroundImageWithURL:[NSURL URLWithString:model.header] forState:UIControlStateNormal];
    self.titleLable.text = model.title;
    self.addLable.text = model.address_describe;
    if ([[STUserManger defult].userID isEqualToString:model.user_id.description]) {
        self.delButton.hidden = NO;
    }else{
        self.delButton.hidden = YES;
    }
}
@end





